﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;

namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class SMSList : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "SMSList";
            }
        }
        #region 属性 (查询条件)


        protected string Mobile
        {
            get
            {
                return GetRequestValue<string>("Mobile", "");

            }
        }

        protected override string orderField
        {
            get
            {
                return string.IsNullOrEmpty(base.orderField) ? "ID" : base.orderField;
            }
        }
        protected override string orderDirection
        {
            get
            {
                return string.IsNullOrEmpty(base.orderDirection) ? "Desc" : base.orderDirection;
            }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
            // this.AddLog(Permission.查看);
        }

        protected string GetSQLWhere()
        {
            string wheresql = "";
            string sqlcommonFiled = "";
            //会员姓名/手机号/身份证
            if (!string.IsNullOrEmpty(Mobile))
            {
                sqlcommonFiled = string.Format("  Mobile like '{0}%' ", Mobile); //QueryOperatorsEnumHelper.ConvertCommonOperator("RealName", QueryOperatorsEnum.包含, RealName);
                wheresql = sqlcommonFiled;
            }

            return wheresql;
        }

        protected void DataBind()
        {
            this.rpMenu.DataSource = SMSProccessController.SMSList_GetPagination(GetSQLWhere(), pageNum, numPerPage, SQLSort, ref TotalCount);
            this.rpMenu.DataBind();
        }

        protected string GetMobileLength(object mobile)
        {
            string xmobile = mobile.ToString();
            if (xmobile.Length <= 11)
                return xmobile;
            else
                return xmobile.Substring(0, 11) + "...";
        }
    }
}